import { request } from "@/api/service";

export const urlPrefix = "/api/dvadmin_wechat/fan_management/";
export const urlPrefixs = "/api/dvadmin_wechat/fan_management/sync/";
export const urlPrefis = "/api/dvadmin_wechat/official_account_management/";
export const urlblackSync = "/api/dvadmin_wechat/fan_management/black_sync/";
export const urlBlackList = "/api/dvadmin_wechat/fan_management/black_list/";
export const urlList = "/api/dvadmin_wechat/fan_tags/";
export const urlTagList = "/api/dvadmin_wechat/fan_management/tag_list/";
export const urlRemark = "/api/dvadmin_wechat/fan_management/set_remark/";

export function GetList(query, id) {
	return request({
		url: urlPrefix + "?official_account_management=" + id,
		method: "get",
		params: query,
	});
}
/**
 * 同步粉丝
 */
export function fan_Sync(query, id) {
	return request({
		url: urlPrefixs + "?official_account_management_id=" + id,
		method: "get",
		params: query,
	});
}
// 分割线-------------------------
/**
 * 获取标签
 */
export function syncList(query, id) {
	return request({
		url: urlList + "?official_account_management_id=" + id,
		method: "get",
		params: query,
	});
}
/**
 * 打标签
 */
export function syncTagList(obj) {
	return request({
		url: urlTagList,
		method: "post",
		data: obj,
	});
}
// 分割线-------------------------

export function GetObj(obj) {
	return request({
		url: urlPrefix + obj.id + "/",
		method: "get",
	});
}

export function createObj(obj, id) {
	const data = { ...obj, tenant: id };
	return request({
		url: urlPrefix,
		method: "post",
		data: data,
	});
}

export function UpdateObj(obj) {
	return request({
		url: urlPrefix + obj.id + "/",
		method: "put",
		data: obj,
	});
}

export function DelObj(id) {
	return request({
		url: urlPrefix + id + "/",
		method: "delete",
		data: { id },
	});
}

export function OfficialObj() {
	return request({
		url: urlPrefis,
		method: "get",
	});
}

export function blackSync(query, id) {
	return request({
		url: urlblackSync + "?official_account_management_id=" + id,
		method: "get",
		params: query,
	});
}

/**
 * 标签管理
 */
export function ListSyncUrl(query, id) {
	return request({
		url: urlPrefix + "?official_account_management_id=" + id,
		method: "get",
		params: query,
	});
}
/**
 * 查看已拉黑
 */
export function isBlackListUrl(query, id) {
	return request({
		url: urlPrefix + "?is_black=0&&official_account_management=" + id,
		method: "get",
		params: query,
	});
}

/**
 * 拉黑用户
 */
export function BlackListUrl(obj) {
	return request({
		url: urlBlackList,
		method: "post",
		data: obj,
	});
}
/**
 * 修改备注
 */
export function RemarkUrl(obj) {
	return request({
		url: urlRemark,
		method: "post",
		data: obj,
	});
}
